﻿using System.Data;
using ECM7.Migrator.Framework;
using ForeignKeyConstraint = ECM7.Migrator.Framework.ForeignKeyConstraint;

namespace music.domain.Migrations
{
	[Migration(6)]
	public class Migration006_UserReferenceFromSong : Migration
	{
		public override void Apply()
		{
			Database.AddColumn("Songs", new Column("UserId", DbType.Guid, ColumnProperty.Null));
			Database.AddForeignKey("FK_SongsUsers", "Songs", "UserId", "Users", "Id", ForeignKeyConstraint.SetNull);
		}

		public override void Revert()
		{
			Database.RemoveConstraint("Songs", "FK_SongsUsers");
			Database.RemoveColumn("Songs", "UserId");
		}
	}
}